home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crosscountry USA Photo Safari
/
Crosscountry USA Photo Safari.iso
/
Data
/
cc_base
/
pak00_16bit_f.pk3
/
common
/
set_cur_state.c4
< prev
next >
Wrap
Text File
|
2002-12-18
|
1KB
|
47 lines
{
@set_cur_state {
resid city_data_id;
resid state_data_id;
resid Player;
resid Game;
resid csv_data_id;
str nav_cur_city;
int city_row;
str state_abrev;
int state_row_num;
str state_name;
Game = ResByName("Game");
Player = ResPropGetResID(Game,"game_cur_player");
csv_data_id = ResByName("CSVData");
city_data_id = ResPropGetResID(csv_data_id, "city_id");
state_data_id = ResPropGetResID(csv_data_id, "state_id");
nav_cur_city = ResPropGetStr(Player,"nav_cur_city");
/* get the city row */
city_row = CSVSearch(city_data_id,"name",nav_cur_city);
/* get the state abbreviation */
state_abrev = CSVGetStr(city_data_id,"state",city_row);
/* search for the state rownum */
state_row_num = CSVSearch(state_data_id,"abbreviation",state_abrev);
/* get the state name */
state_name = CSVGetStr(state_data_id,"name",state_row_num);
/* update the player nav_cur_state */
ResPropSetStr(Player,"nav_cur_state",state_name);
/* update the player nav_cur_state_row_num */
ResPropSetInt(Player,"nav_cur_state_row_num",state_row_num);
}
}